//
//  MyOrderViewController.m
//  LoveFreshBee
//
//  Created by brice Mac on 2016/10/20.
//  Copyright © 2016年 王忠迪. All rights reserved.
//

#import "MyOrderViewController.h"

@interface MyOrderViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)NSArray *imgArray;

@end

@implementation MyOrderViewController

- (NSArray *)imgArray {
    if (_imgArray == nil) {
        NSMutableArray *nmArr = [NSMutableArray array];
        for (int i = 0; i < 7; i++) {
            
            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 150)];
            NSString *imgName = [NSString stringWithFormat:@"order_%d",i];
            img.image = [UIImage imageNamed:imgName];
            img.userInteractionEnabled = YES;
            [nmArr addObject:img];
        }
        _imgArray = nmArr;
    }
    return _imgArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self imgArray];
    //加载 xib
    UINib *nib = [UINib nibWithNibName:@"ZHMyAddressCell" bundle:nil];
    [self.tableView registerNib:nib forCellReuseIdentifier:@"MyAddressCellId"];
    
    self.tableView.rowHeight = 100;
    
}

- (void)setupTableView {
    
    UITableView *tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
    self.tableView = tableView;
    [self.view addSubview:tableView];
    tableView.contentInset = UIEdgeInsetsMake(64, 0, 49, 0);
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 5;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyAddressCellId" forIndexPath:indexPath];
    
<<<<<<< Updated upstream
    return cell;
}

=======
    UIImageView *img = self.imgArray[indexPath.section];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(orderViewDidClick)];
    [img addGestureRecognizer:tap];
    
    
    [cell.contentView addSubview:img];
    
    return cell;
}

- (void)orderViewDidClick {
    
    OrderDetailViewController *detail = [[OrderDetailViewController alloc]init];
    
    [self.navigationController pushViewController:detail animated:YES];
}
>>>>>>> Stashed changes


//头部高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.01;
}

@end





